<cfcomponent>
	<CFFUNCTION NAME = "getByDept"
	             ACCESS = "REMOTE"
	             SECUREJSON = "YES" 
                 RETURNTYPE="query">
        <cfargument name="deptCode" required="yes">
  
        
		<cfquery datasource="#client.company_dsn#" name="qryCMFPA">
			<cfif uCase(client.DBMS) eq 'MSSQL'>
                SELECT ('('+PA.PERSONNELIDNO+') '+PA.LASTNAME+', '+PA.FIRSTNAME+ +PA.MIDDLENAME )AS GUID,
          		 (PA.PERSONNELIDNO+'~'+PA.GUID) AS ID
            <cfelse>
                SELECT concat( "(",PA.PERSONNELIDNO,") ",PA.LASTNAME,", ",PA.FIRSTNAME," ",PA.MIDDLENAME) as GUID,
                    CONCAT(PA.PERSONNELIDNO,"~",PA.GUID) as ID
            </cfif>
            
            FROM CMFPA PA
            LEFT JOIN CLKDEPARTMENT DEPT ON DEPT.DEPARTMENTCODE = PA.DEPARTMENTCODE
            WHERE PA.DEPARTMENTCODE = '#deptCode#' 
            ORDER BY PA.LASTNAME, PA.FIRSTNAME,PA.MIDDLENAME
        </cfquery>
        
		<CFRETURN qryCMFPA>
	</CFFUNCTION>
</cfcomponent>
